package com.cloud.util;

import java.io.Serializable;

/**
 * 一般返回结果工具
 * @author touch
 *
 */
public class R implements Serializable {
	private Integer code; //一般0表示成功
	private String msg;
	private Object data;
	public R() {
		
	}
	public R(Integer code,String msg,Object data) {
		this.code = code;
		this.msg = msg;
		this.data = data;
	}
	public static R ok() {
		return new R(0,"success",null);
	}
	public static R ok(Object data) {
		return new R(0,"success",data);
	}
	public static R error() {
		return new R(9,"error",null);
	}
	public static R error(String msg) {
		return new R(9,msg,null);
	}

	public Integer getCode() {
		return code;
	}
	public void setCode(Integer code) {
		this.code = code;
	}
	public String getMsg() {
		return msg;
	}
	public void setMsg(String msg) {
		this.msg = msg;
	}
	public Object getData() {
		return data;
	}
	public void setData(Object data) {
		this.data = data;
	}
}
